package cc.vv.btpartyjob.jobactivities.delegate

import android.view.View
import android.widget.RelativeLayout
import cc.vv.baselibrary.view.OvalImageView
import cc.vv.baselibrary.view.banner.ImgBannerView
import cc.vv.btpartyjob.jobactivities.R
import cc.vv.btpartyjob.jobactivities.inter.JobItemClickInterface
import cc.vv.btpartyjob.jobactivities.moudel.bean.JobBean
import cc.vv.btpartyjob.jobactivities.view.JobOperationView
import cc.vv.lkimagecomponent2.LKImage
import cc.vv.lkimagecomponent2.lib.mode.ScaleMode
import cc.vv.mvp.delegate.BaseAppDelegate

/**
 * 工作活动托管类
 * Created by Chen.qi on 2018/10/24.
 */
class JobActivitiesMainFragmentDelegate : BaseAppDelegate() {

    override fun initWidget() {
    }

    override fun initLayoutRes(): Int {
        return R.layout.fragment_jobactivities_main
    }

    /**
     * 设置顶部核心价值观图片数据
     */
    fun setPicTop() {
        val viewTop = getView<OvalImageView>(R.id.oiv_fjm_top)
        LKImage.load().scale(ScaleMode.CENTER_CROP).loadAsserts("icon_job_hxjzg.png").into(viewTop)
    }

    /**
     * 设置banner
     */
    fun setBannerData(list: ArrayList<String>, listTitle: ArrayList<String>, inter: ImgBannerView.ImgBannerClickInter) {
//        val bannerView = getView<ImgBannerView>(R.id.ibv_fjm_banner)
//        bannerView?.initWHPercentage(351, 166, -1)
//        bannerView?.initImgData(list, listTitle, inter)
//        bannerView?.initIndicatorView(R.mipmap.icon_point_selector_no, R.mipmap.icon_point_selector_yes, 8, 5)
    }


    /**
     * 设置新闻头条数据
     */
    fun setData(optionList: ArrayList<JobBean>?, itemClickCallBack: JobItemClickInterface?) {
        getView<JobOperationView>(R.id.jov_fjm_jobOpera).addAllSelectedFileView(optionList, 4, itemClickCallBack)
    }

    /**
     * 设置示范典型数据
     */
    fun setDataTypical(optionList: ArrayList<JobBean>?, itemClickCallBack: JobItemClickInterface?) {
        getView<JobOperationView>(R.id.jov_fjm_typical).addAllSelectedFileView(optionList, 4, itemClickCallBack)
    }

    /**
     * 民主生活会是否显示
     */
    fun showMingZhuShengHuoHui(isShow: Boolean) {
        val viewMZ = getView<RelativeLayout>(R.id.rl_fjm_mzLife)
        val line1 = getView<View>(R.id.vw_fjm_line1)
        if (isShow) {
            viewMZ?.visibility = View.VISIBLE
            line1?.visibility = View.VISIBLE
        } else {
            viewMZ?.visibility = View.GONE
            line1?.visibility = View.GONE
        }
    }


    /**
     * 组织生活会
     */
    fun showZuZhiLifeMeeting(isShow: Boolean) {
        val viewZZ = getView<RelativeLayout>(R.id.rl_fjm_zuZhiLife)
        val line2 = getView<View>(R.id.vw_fjm_line2)
        if (isShow) {
            viewZZ?.visibility = View.VISIBLE
            line2?.visibility = View.VISIBLE
        } else {
            viewZZ?.visibility = View.GONE
            line2?.visibility = View.GONE
        }
    }

    /**
     * 三会一课
     */
    fun showSanHuiYiKe(isShow: Boolean) {
        val viewShyk = getView<RelativeLayout>(R.id.rl_fjm_sanHuiYiKe)
        val line3 = getView<View>(R.id.vw_fjm_line3)
        if (isShow) {
            viewShyk?.visibility = View.VISIBLE
            line3.visibility = View.VISIBLE
        } else {
            viewShyk?.visibility = View.GONE
            line3.visibility = View.GONE
        }
    }

    /**
     * 支部活动
     */
    fun showZhiBuHuoDong(isShow: Boolean) {
        val viewZbhd = getView<RelativeLayout>(R.id.rl_fjm_zhiBuHuoDong)
        val line5 = getView<View>(R.id.vw_fjm_line5)

        if (isShow) {
            viewZbhd?.visibility = View.VISIBLE
            line5?.visibility = View.VISIBLE
        } else {
            viewZbhd?.visibility = View.GONE
            line5?.visibility = View.GONE
        }
    }
}